<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<table id="td1" border="1" cellspacing="0" cellpadding="0">
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
ddd
			</tr>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>

			</tr>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>

			</tr>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>

			</tr>
		</table>
		<table border="1" cellspacing="" cellpadding="">
			<tr>
				<td>dddd</td>
				<td>ddd</td>
				<td>dd</td>
				<td>d</td>
			</tr>
			
		</table>
		<script type="text/javascript">
			
			var td1=document.getElementById("td1")
			var tds = td1.getElementsByTagName("td");
			for(var i = 0; i < tds.length; i++) {
				tds[i].innerHTML = i + 1;
			}
		</script>
	</body>

</html>